#!/bin/bash

DOMAIN=build/libs/bilibili-task.jar
PORT=8080

mkdir -p build/libs
rm -rf build/libs/*.jar
cp ../target/bilibili-task.jar ${DOMAIN}

docker images | grep pre/bilibili-task &> /dev/null
if [ $? -eq 0 ]
then
    docker rmi pre/bilibili-task:pre
fi

docker images | grep bilibili-task &> /dev/null
if [ $? -eq 0 ]
then
    docker tag bilibili-task:lastest pre/bilibili-task:pre
fi

 docker build --build-arg JAR_FILE="${DOMAIN}" --build-arg PORT=${PORT} -t bilibili-task:lastest -f ../Dockerfile --no-cache .
